package com.dapeis.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;

import com.ag.dao.DBService;
import com.ag.dao.IDao;
import com.dapeis.dao.ICollocationMapper;
import com.dapeis.dao.ICollocationSupplyMapper;
import com.dapeis.domain.Collocation;
import com.dapeis.domain.Bank;

/**
 * 
 * @author win7
 *
 */
@Service
public class BankService extends DBService<Bank> {
    @Resource
    ICollocationSupplyMapper mapper;

    @Override
    protected IDao<Bank> getIDao() {
	return mapper;
    }

    
    public Bank queryBankByCollocaitonId(Integer collocationId) {
	Example example = new Example(Bank.class);
	Criteria criteria = example.createCriteria();
	criteria.andEqualTo(Bank.PROPERTY_COLLOCATION_ID, collocationId);
	List<Bank> list = mapper.selectByExample(example);
	if (list.isEmpty())
	    return null;
	return list.get(0);

    }
}
